package com.yulan.bankback.mapper.bank;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yulan.bankback.entity.model.bank.BankUser;
import com.yulan.bankback.entity.model.bank.UserBalance;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface BankUserMapper extends BaseMapper<BankUser> {

    @Select("select id, uid, balance, time from user_balance where time >= NOW() - INTERVAL ${interval}" +
            " and uid = #{uid}")
    List<UserBalance> getBalanceInterval(@Param("uid") String uid,
                                         @Param("interval") String interval);
}
